#include<bits/stdc++.h>
using namespace std;
int a[210001],l[210001],r[210001],bj[210001],p[210001];
int main()
{
	freopen("fruit.in","r",stdin);
	freopen("fruit.out","w",stdout);
	int n;
	scanf("%d",&n);
	r[0]=1;
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
		l[i]=i-1;
		r[i]=i+1;
	}
	int op=0;
	while(op!=n)
	{
		int o=0;
		memset(p,0,sizeof(p));
		int u=r[0];
		for(int i=u;i<=n;i=r[i])
		{
			if(i==u)
			{
				printf("%d ",i);
				p[++o]=i;
				op++;
				continue;
			}
			if(a[i]!=a[l[i]])
			{
				printf("%d ",i);
				p[++o]=i;
				op++;
			}
		}
		for(int i=1;i<=o;i++)
		{
			if(p[i]==u)
			{
				r[0]=r[p[i]];
				l[r[p[i]]]=0;	
				r[p[i]]=2147483647;
				l[p[i]]=2147483647;
			}
			else
			{
				l[r[p[i]]]=l[p[i]];
				r[l[p[i]]]=r[p[i]];
				r[p[i]]=2147483647;
				l[p[i]]=2147483647;
			}
		}	
		printf("\n");
	}	
}
